package user;

import book.BookList;
import function.*;

import java.util.Scanner;

public class NormalUser extends User{
    public NormalUser(String name, int power) {
        super(name);
        this.power = power;
        this.action = new IFunction[] {
                new ExitSystem(),
                new SearchBook(),
                new BorrowBook(),
                new ReturnBook()
        };
    }

    @Override
    public int menu() {
        System.out.println("************************");
        System.out.println("1.查找书籍");
        System.out.println("2.借阅书籍");
        System.out.println("3.归还书籍");
        System.out.println("0.退出系统");
        System.out.println("************************");
        System.out.println("请选择：");
        Scanner s = new Scanner(System.in);
        return s.nextInt();
    }

    @Override
    public void doAction(int choice, BookList bookList) {
        action[choice].act(bookList);
    }
}
